﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Windows.Input;
using MSDNWebcast.Models;

namespace MSDNWebcast.Commands
{
    /// <summary>
    /// 全局命令
    /// </summary>
    public class GlobalCommands
    {

        private static DelegateCommand<string> s_OpenUrl;

        /// <summary>
        /// 打开视频
        /// </summary>
        public static DelegateCommand<CourseFile> OpenVideo;

        /// <summary>
        /// 打开链接
        /// </summary>
        public static DelegateCommand<string> OpenUrl
        {
            get
            {
                if (s_OpenUrl == null)
                {
                    s_OpenUrl = new DelegateCommand<string>(x => Process.Start(new ProcessStartInfo(x)),
                                                            x => !String.IsNullOrEmpty(x));
                }
                return s_OpenUrl;
            }
        }
    }
}
